package com.yunhe.marketing.repository;

import com.yunhe.marketing.domain.Enterprise;
import com.yunhe.marketing.esdomain.EsDataClueDemand;
import com.yunhe.marketing.model.ClueQueryCondition;
import com.yunhe.marketing.model.DemandQueryCondition;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @Author: DongWenYu
 * @Date: 2021/2/22 16:11
 */
@Repository
public interface EnterpriseRepository {

    /**
     * [新增]
     * @param enterprise 
     * @return int 
     * @create 2021/2/22 17:46
     */
    int insert(Enterprise enterprise);

    /**
     * [批量新增]
     * @param enterpriseList 
     * @return int 
     * @create 2021/2/23 10:43
     */
    int insertBatch(List<Enterprise> enterpriseList);

    /**
     * [刪除]
     * @param id 
     * @return Long
     * @create 2021/2/22 17:39
     */
    int delete(Long id);

    /**
     * [更新]
     * @param enterprise 
     * @return int 
     * @create 2021/2/22 17:39
     */
    int updateById(Enterprise enterprise);
    
    /**
     * [查询] 根据主键 id 查询
     * @param id 
     * @return Enterprise 
     * @create 2021/2/22 17:38
     */
    Enterprise selectEnterpriseById(Long id);

    /**
     * [查询] 根据根据informationType查询
     * @param informationType 1为线索，2为需求
     * @return List<Enterprise>
     * @create 2021/2/22 17:37
     */
    List<Enterprise> selectEnterpriseByInformationType(String informationType);

    /**
     * [查询] 根据根据license查询
     * @param license 营业执照号
     * @return com.yunhe.marketing.domain.Enterprise
     * @create 2021/2/23 15:42
     */
    Enterprise selectEnterpriseByLicense(String license);

    /**
     * @Description 根据条件筛选查询
     * @Param clueQueryCondition
     * @Return List<Enterprise>
     * @Date 2021/2/23 15:34
     */
    List<Enterprise> selectClueByClueQueryCondition(ClueQueryCondition clueQueryCondition);

    /**
     * @Description 根据条件筛选需求
     * @Param demandQueryCondition
     * @Return List<Enterprise>
     * @Date 2021/2/23 17:19
     */
    List<Enterprise> selectDemandByDemandQueryCondition(DemandQueryCondition demandQueryCondition);

    /**
     * 根据企业id批量全量更新
     * @param enterpriseList 更新后的企业信息集
     * @return int
     * @create 2021/2/26 15:58
     */
    int updateBatchById(List<Enterprise> enterpriseList);

    /**
     * 根据企业id集合批量查找企业
     * @param ids 企业id集合
     * @return java.util.List<com.yunhe.marketing.domain.Enterprise> 
     * @create 2021/2/26 16:01
     */
    List<Enterprise> selectEnterpriseByIdBatch(@Param("ids") List<Long> ids);

    /**
     * 筛选已分配的线索
     * @param clueQueryCondition 筛选条件
     * @return java.util.List<com.yunhe.marketing.domain.Enterprise>
     * @create 2021/2/26 16:02
     */
    List<Enterprise> selectClueByClueQueryConditionForTask(ClueQueryCondition clueQueryCondition);

    /**
     * 筛选已分配的需求
     * @param demandQueryCondition 筛选条件
     * @return java.util.List<com.yunhe.marketing.domain.Enterprise>
     * @create 2021/2/26 16:02
     */
    List<Enterprise> selectDemandByDemandQueryConditionForTask(DemandQueryCondition demandQueryCondition);

    /**
     * @Description 根据企业id查询线索（查看线索详情）
     * @Param Long id
     * @Return Enterprise
     * @Date 2021/2/26 17:31
     */
    Enterprise selectClueById(Long id);

    /**
     * @Description 根据企业id查询需求（查看需求详情）
     * @Param Long id
     * @Return Enterprise
     * @Date 2021/2/26 17:34
     */
    Enterprise selectDemandById(Long id);

    List<Enterprise> getDataClueDemandBySynchronizeFlag(int count);

    void updateSynchronizeFlagById(List<EsDataClueDemand> esDataClueDemands);
}
